<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>File Source for Nabaztag.php</title>
  <link rel="stylesheet" href="../media/stylesheet.css" />
<!-- template designed by Julien Damon based on PHPEdit's generated templates, and tweaked by Greg Beaver -->
<body bgcolor="#ffffff" ><h1 align="center">Source for file Nabaztag.php</h1>
<p>Documentation is available at <a href="../SWX/_services---Nabaztag.php.html">Nabaztag.php</a></p>
<div class="src-code">
<div class="src-code"><ol><li><div class="src-line"><a name="a1"></a><strong>&lt;?php</strong></div></li>
<li><div class="src-line"><a name="a2"></a>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#009999">/**</font></div></li>
<li><div class="src-line"><a name="a3"></a><font color="#009999">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Class:&nbsp;Nabaztag</font></div></li>
<li><div class="src-line"><a name="a4"></a><font color="#009999">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</font></div></li>
<li><div class="src-line"><a name="a5"></a><font color="#009999">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;The&nbsp;Nabaztag&nbsp;API.</font></div></li>
<li><div class="src-line"><a name="a6"></a><font color="#009999">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Part&nbsp;of&nbsp;Yahoo!&nbsp;Hack&nbsp;Day&nbsp;London.</font></div></li>
<li><div class="src-line"><a name="a7"></a><font color="#009999">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</font></div></li>
<li><div class="src-line"><a name="a8"></a><font color="#009999">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</font><strong><font color = "#0099FF">@author</font></strong><font color="#009999">&nbsp;Aral&nbsp;Balkan</font></div></li>
<li><div class="src-line"><a name="a9"></a><font color="#009999">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;***/</font></div></li>
<li><div class="src-line"><a name="a10"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a11"></a>&nbsp;&nbsp;&nbsp;&nbsp;<font color="green">//&nbsp;Require&nbsp;base&nbsp;service&nbsp;class</font></div></li>
<li><div class="src-line"><a name="a12"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="blue">require_once</font><strong>(</strong><font color="#66cccc">&quot;../BaseService.php&quot;</font><strong>)</strong><strong>;</strong></div></li>
<li><div class="src-line"><a name="a13"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a14"></a>&nbsp;&nbsp;&nbsp;&nbsp;<font color="blue">class&nbsp;</font><a href="../SWX/Nabaztag.html">Nabaztag</a>&nbsp;<font color="blue">extends&nbsp;</font>BaseService</div></li>
<li><div class="src-line"><a name="a15"></a>&nbsp;&nbsp;&nbsp;&nbsp;<strong>{</strong></div></li>
<li><div class="src-line"><a name="a16"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="green">//&nbsp;Replace&nbsp;these&nbsp;with&nbsp;your&nbsp;own&nbsp;serial</font></div></li>
<li><div class="src-line"><a name="a17"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="green">//&nbsp;number&nbsp;and&nbsp;token&nbsp;from&nbsp;nabaztag.com.</font></div></li>
<li><div class="src-line"><a name="a18"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="blue">var&nbsp;</font><a href="../SWX/Nabaztag.html#var$sn">$sn</a>&nbsp;=&nbsp;<font color="#66cccc">&quot;0013d384686d&quot;</font><strong>;</strong></div></li>
<li><div class="src-line"><a name="a19"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="blue">var&nbsp;</font><a href="../SWX/Nabaztag.html#var$token">$token</a>&nbsp;=&nbsp;<font color="#66cccc">&quot;1182055607&quot;</font><strong>;</strong></div></li>
<li><div class="src-line"><a name="a20"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a21"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#009999">/**</font></div></li>
<li><div class="src-line"><a name="a22"></a><font color="#009999">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Sends&nbsp;a&nbsp;message&nbsp;for&nbsp;a&nbsp;Nabaztag&nbsp;bunny&nbsp;to&nbsp;speak.</font></div></li>
<li><div class="src-line"><a name="a23"></a><font color="#009999">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</font></div></li>
<li><div class="src-line"><a name="a24"></a><font color="#009999">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;If&nbsp;you&nbsp;call&nbsp;this&nbsp;method&nbsp;without&nbsp;sending&nbsp;a&nbsp;serial&nbsp;number&nbsp;and&nbsp;token,&nbsp;it&nbsp;will&nbsp;use&nbsp;the</font></div></li>
<li><div class="src-line"><a name="a25"></a><font color="#009999">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;serial&nbsp;number&nbsp;and&nbsp;token&nbsp;defined&nbsp;in&nbsp;the&nbsp;service&nbsp;class.&nbsp;For&nbsp;the&nbsp;service&nbsp;class&nbsp;on&nbsp;the</font></div></li>
<li><div class="src-line"><a name="a26"></a><font color="#009999">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;SWX&nbsp;public&nbsp;gateway,&nbsp;this&nbsp;means&nbsp;that&nbsp;Aral's&nbsp;bunny&nbsp;will&nbsp;speak&nbsp;it.&nbsp;(Really,&nbsp;so&nbsp;be&nbsp;nice!)&nbsp;:)</font></div></li>
<li><div class="src-line"><a name="a27"></a><font color="#009999">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</font></div></li>
<li><div class="src-line"><a name="a28"></a><font color="#009999">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</font><strong><font color = "#0099FF">@param&nbsp;</font></strong><em>(str)&nbsp;</em><font color="#009999">Message&nbsp;to&nbsp;speak.</font></div></li>
<li><div class="src-line"><a name="a29"></a><font color="#009999">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</font><strong><font color = "#0099FF">@param&nbsp;</font></strong><em>(str,&nbsp;</em><font color="#009999">optional)&nbsp;Serial&nbsp;number&nbsp;of&nbsp;the&nbsp;bunny&nbsp;you&nbsp;want&nbsp;to&nbsp;send&nbsp;the&nbsp;message&nbsp;to.</font></div></li>
<li><div class="src-line"><a name="a30"></a><font color="#009999">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</font><strong><font color = "#0099FF">@param&nbsp;</font></strong><em>(str,&nbsp;</em><font color="#009999">optional)&nbsp;Token&nbsp;for&nbsp;the&nbsp;bunny&nbsp;you&nbsp;want&nbsp;to&nbsp;send&nbsp;the&nbsp;message&nbsp;to.</font></div></li>
<li><div class="src-line"><a name="a31"></a><font color="#009999">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*</font></div></li>
<li><div class="src-line"><a name="a32"></a><font color="#009999">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</font><strong><font color = "#0099FF">@return&nbsp;</font></strong><em>void&nbsp;</em></div></li>
<li><div class="src-line"><a name="a33"></a><font color="#009999">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</font><strong><font color = "#0099FF">@author</font></strong><font color="#009999">&nbsp;Aral&nbsp;Balkan</font></div></li>
<li><div class="src-line"><a name="a34"></a><font color="#009999">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;***/</font></div></li>
<li><div class="src-line"><a name="a35"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="blue">function&nbsp;</font><a href="../SWX/Nabaztag.html#methodtalk">talk</a>&nbsp;<strong>(</strong><strong>$tts</strong><strong>,&nbsp;</strong><strong>$sn&nbsp;</strong>=&nbsp;NULL<strong>,&nbsp;</strong><strong>$token&nbsp;</strong>=&nbsp;NULL<strong>)</strong></div></li>
<li><div class="src-line"><a name="a36"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</strong></div></li>
<li><div class="src-line"><a name="a37"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>$url&nbsp;</strong>=&nbsp;<font color="#66cccc">&quot;http://api.nabaztag.com/vl/FR/api.jsp&quot;</font><strong>;</strong></div></li>
<li><div class="src-line"><a name="a38"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>$args&nbsp;</strong>=&nbsp;array<strong>(</strong><font color="#66cccc">'tts'&nbsp;</font>=&gt;&nbsp;<strong>$tts</strong><strong>)</strong><strong>;</strong></div></li>
<li><div class="src-line"><a name="a39"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a40"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>$this</strong><strong>-&gt;</strong><a href="../SWX/Nabaztag.html#method_addSerialToken">_addSerialToken</a><strong>(</strong><strong>&amp;</strong><strong>$args</strong><strong>,&nbsp;</strong><strong>$sn</strong><strong>,&nbsp;</strong><strong>$token</strong><strong>)</strong><strong>;</strong></div></li>
<li><div class="src-line"><a name="a41"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a42"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>$result&nbsp;</strong>=&nbsp;<strong>$this</strong><strong>-&gt;</strong>_call<strong>(</strong><strong>$url</strong><strong>,&nbsp;</strong><strong>$args</strong><strong>)</strong><strong>;</strong></div></li>
<li><div class="src-line"><a name="a43"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a44"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="blue">return&nbsp;</font><strong>$result</strong><strong>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</strong></div></li>
<li><div class="src-line"><a name="a45"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>}</strong></div></li>
<li><div class="src-line"><a name="a46"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a47"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="blue">function&nbsp;</font><a href="../SWX/Nabaztag.html#method_addSerialToken">_addSerialToken</a><strong>(</strong><strong>&amp;</strong><strong>$args</strong><strong>,&nbsp;</strong><strong>$sn&nbsp;</strong>=&nbsp;NULL<strong>,&nbsp;</strong><strong>$token&nbsp;</strong>=&nbsp;NULL<strong>)</strong></div></li>
<li><div class="src-line"><a name="a48"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>{</strong></div></li>
<li><div class="src-line"><a name="a49"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>$sn&nbsp;</strong>=&nbsp;<strong>(</strong><strong>$sn&nbsp;</strong>==&nbsp;NULL<strong>)&nbsp;</strong>?&nbsp;<strong>$this</strong><strong>-&gt;</strong><a href="../SWX/Nabaztag.html#var$sn">sn</a>&nbsp;:&nbsp;<strong>$sn</strong><strong>;</strong></div></li>
<li><div class="src-line"><a name="a50"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>$token&nbsp;</strong>=&nbsp;<strong>(</strong><strong>$token&nbsp;</strong>==&nbsp;NULL<strong>)&nbsp;</strong>?&nbsp;<strong>$this</strong><strong>-&gt;</strong><a href="../SWX/Nabaztag.html#var$token">token</a>&nbsp;:&nbsp;<strong>$token</strong><strong>;</strong></div></li>
<li><div class="src-line"><a name="a51"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a52"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>$args</strong><strong>[</strong><font color="#66cccc">'sn'</font><strong>]&nbsp;</strong>=&nbsp;<strong>$sn</strong><strong>;</strong></div></li>
<li><div class="src-line"><a name="a53"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>$args</strong><strong>[</strong><font color="#66cccc">'token'</font><strong>]&nbsp;</strong>=&nbsp;<strong>$token</strong><strong>;</strong></div></li>
<li><div class="src-line"><a name="a54"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>}</strong></div></li>
<li><div class="src-line"><a name="a55"></a>&nbsp;&nbsp;&nbsp;&nbsp;<strong>}</strong></div></li>
<li><div class="src-line"><a name="a56"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a57"></a><strong>?&gt;</strong></div></li>
</ol></div>
</div>
	<div id="credit">
		<hr />
		Documentation generated on Fri, 06 Jul 2007 19:54:51 +0100 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.3.1</a>
	</div>
</body>
</html>